
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 1
 * @Author : WangRuoyu 
 * @Date : 2023/5/18 17:07
 */

#include "iostream"

using namespace std;

int main() {
    int n, N;
    scanf("%d %d", &n, &N);

    int a[n + 2];
    for (int i = 0; i < n + 2; ++i) {
        if (i == 0) {
            a[i] = 0;
        } else if (i == n + 1) {
            a[i] = N;
        } else {
            scanf("%d", &a[i]);
        }
    }

    int res = 0;
    for (int i = 1; i <= n; ++i) {
        res += (a[i + 1] - a[i]) * i;
    }

    cout << res;

    return 0;
}